

    \filetitle{db2array}{Convert tseries database entries to numeric array}{dbase/db2array}

	\paragraph{Syntax}

\begin{verbatim}
[X,Incl,Range] = db2array(D)
[X,Incl,Range] = db2array(D,List)
[X,Incl,Range] = db2array(D,List,Range,...)
\end{verbatim}

\paragraph{Input arguments}

\begin{itemize}
\item
  \texttt{D} {[} struct {]} - Input database with tseries objects that
  will be converted to a numeric array.
\item
  \texttt{List} {[} char \textbar{} cellstr {]} - List of tseries names
  that will be converted to a numeric array; if not specified, all
  tseries entries found in the input database, \texttt{D}, will be
  included in the output arrays, \texttt{X}.
\item
  \texttt{Range} {[} numeric \textbar{} \texttt{Inf} {]} - Date range;
  \texttt{Inf} means a range from the very first non-NaN observation to
  the very last non-NaN observation.
\end{itemize}

\paragraph{Output arguments}

\begin{itemize}
\item
  \texttt{X} {[} numeric {]} - Numeric array with observations from
  individual tseries objects in columns.
\item
  \texttt{Incl} {[} cellstr {]} - List of tseries names that have been
  actually found in the database.
\item
  \texttt{Range} {[} numeric {]} - Date range actually used; this output
  argument is useful when the input argument \texttt{Range} is missing
  or \texttt{Inf}.
\end{itemize}

\paragraph{Description}

The output array, \texttt{X}, is always NPer-by-NList-by-NAlt, where
NPer is the length of the \texttt{Range} (the number of periods), NList
is the number of tseries included in the \texttt{List}, and NAlt is the
maximum number of columns that any of the tseries included in the
\texttt{List} have.

If all tseries data have the same size in 2nd and higher dimensions, the
output array will respect that size in 3rd and higher dimensions. For
instance, if all tseries data are NPer-by-2-by-5, the output array will
be NPer-by-Nx-by-2-by-5. If some tseries data have unmatching size in
2nd or higher dimensions, the output array will be always a 3D array
with all higher dimensions unfolded in 3rd dimension.

If some tseries data have smaller size in 2nd or higher dimensions than
other tseries entries, the last available column will be repeated for
the missing columns.

\paragraph{Example}


